﻿
    <metro:Window x:Class="cdmaDevTerm.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:metro="http://schemas.codeplex.com/elysium/theme"
        xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
                  
              Title="cdmaDevTerm .2.92ish (c)12.15 dg chromableedstudios.com"
              Height="650" Width="554" 
              AllowsTransparency="False" WindowStyle="ThreeDBorderWindow">
    <Grid>
        <StackPanel Margin="2" HorizontalAlignment="Right"  Orientation="Horizontal">
            <TextBox Margin="5" MinWidth="50" Text="{Binding Path=Meid,   PresentationTraceSources.TraceLevel=High}" HorizontalAlignment="Left"  Name="MeidLabel" VerticalAlignment="Top" FontFamily="Segoe UI" FontWeight="Bold" FontSize="22" BorderThickness="0" IsEnabled="True" IsReadOnly="True">
                <TextBox.ToolTip>
                    <ToolTip>
                        <TextBlock Text="meid"/>
                    </ToolTip>
                </TextBox.ToolTip>
                <ContextMenuService.ContextMenu>
                    <ContextMenu>
                        <MenuItem Header="Copy" Command="Copy"></MenuItem>
                        <MenuItem Name="copyMeidConverted" Header="Copy Meid Converted" Click="copyMeidConverted_Click_1"/>
                    </ContextMenu>
                </ContextMenuService.ContextMenu>
            </TextBox>
            <TextBox MinWidth="50" Margin="5,5,5,5" Text="{Binding Path=Esn}"  HorizontalAlignment="Left" Name="EsnLabel" VerticalAlignment="Top" FontFamily="Segoe UI" FontSize="14" BorderThickness="0" IsReadOnly="True">
                <TextBox.ToolTip>
                    <ToolTip>
                        <TextBlock Text="esn"/>
                    </ToolTip>
                </TextBox.ToolTip>
                <ContextMenuService.ContextMenu>
                    <ContextMenu>
                        <MenuItem Header="Copy" Command="Copy" ></MenuItem>
                        <MenuItem Name="copyEsnConverted" Header="Copy Esn Converted" Click="copyEsnConverted_Click_1"/>
                    </ContextMenu>
                </ContextMenuService.ContextMenu>
            </TextBox>
        </StackPanel>
        <Grid Margin="20,40,20,20">
      <StackPanel>
            


        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Top">
            <StackPanel Margin="2"  Orientation="Horizontal">
                        <ComboBox  HorizontalAlignment="Left" Margin="2" Name="comBox" VerticalAlignment="Top" Width="275"
                            SelectedItem="{Binding ComPortName}"
                              ItemsSource="{Binding AvailableComPorts}" >
                           
                        </ComboBox>
                        <Button Margin="2" HorizontalAlignment="Left"  Name="Send" VerticalAlignment="Top" Width="60" Click="Scan_Click" >
                    <StackPanel Orientation="Horizontal">
                        <Image Source="Resources/refresh.png" Stretch="Uniform" Height="20" Width="20" />
                        
                    </StackPanel>
                            <Button.ToolTip>
                                <ToolTip>
                                    <TextBlock Text="scan" />
                                </ToolTip>
                            </Button.ToolTip>
                        </Button>
                        <Button  Margin="2" HorizontalAlignment="Left" Name="Connect" VerticalAlignment="Bottom" Width="60" Click="Connect_Click" >
                    <StackPanel Orientation="Horizontal">
                        <Image Source="Resources/check.png" Stretch="Uniform" Height="20" Width="20" />
                    </StackPanel>
                            <Button.ToolTip>
                                <ToolTip>
                                    <TextBlock Text="connect" />
                                </ToolTip>
                            </Button.ToolTip>

                        </Button>

                <Button  Margin="2" HorizontalAlignment="Left" Name="Disconnect" VerticalAlignment="Top" Width="60" Click="button1_Click_1" >
                    <StackPanel Orientation="Horizontal">
                        <Image Source="Resources/cancel.png" Stretch="Uniform" Height="20" Width="20" />
                    </StackPanel>
                            <Button.ToolTip>
                                <ToolTip>
                                    <TextBlock Text="disconnect" />
                                </ToolTip>
                            </Button.ToolTip>
                        </Button>
            </StackPanel>
        </StackPanel>
                <StackPanel>
                    <StackPanel Margin="2,2,20,2" Orientation="Horizontal" HorizontalAlignment="Right">
                        <CheckBox Name="AutoQcRead" Content="AUTO QC READ" IsChecked="True"  ></CheckBox>
                        <Button  Margin="2" HorizontalAlignment="Left"  Name="readPhone"  Width="60" Click="readPhone_Click" >
                            <StackPanel Orientation="Horizontal">
                                <Image Source="Resources/download.png" Stretch="Uniform" Height="20" Width="20" />

                            </StackPanel>

                            <Button.ToolTip>
                                <ToolTip>
                                    <TextBlock Text="read phone"/>
                                </ToolTip>
                            </Button.ToolTip>
                        </Button>
                        <Button  Margin="2" HorizontalAlignment="Left"  Name="writeNam" Click="writeNam_Click"  Width="60" >
                            <StackPanel Orientation="Horizontal">
                                <Image Source="Resources/edit.png" Stretch="Uniform" Height="20" Width="20" />

                            </StackPanel>

                            <Button.ToolTip>
                                <ToolTip>
                                    <TextBlock Text="write: mdn, min, namLock, userlock, sid, nid, mip num/enable, qcmip, and NV"/>
                                </ToolTip>
                            </Button.ToolTip>
                        </Button>
                        
                    </StackPanel>
                    

                </StackPanel>
                

                <TabControl HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="tabControl1" VerticalAlignment="Stretch" MinWidth="475" TabStripPlacement="Top" UseLayoutRounding="False" SelectionChanged="tabControl1_SelectionChanged_1">
                    <TabControl.Resources>
                        <Style TargetType="{x:Type TabPanel}">
                            <Setter Property="HorizontalAlignment" Value="Center" />
                        </Style>
                    </TabControl.Resources>

                    <TabItem Header="Phone" Name="PhoneTab" >
                        <Grid HorizontalAlignment="Center" >
                            <StackPanel>

                                <StackPanel Margin="2"  Orientation="Horizontal">
                                    <TextBlock Margin="5" Text="MDN"  HorizontalAlignment="Left"  Name="MdnLabel" VerticalAlignment="Top" FontFamily="Segoe UI" />
                                    <TextBox   Text="{Binding Path=Mdn,   PresentationTraceSources.TraceLevel=High}" HorizontalAlignment="Left" MinWidth="94" VerticalAlignment="Bottom" MaxLength="10">
                                        
                                    </TextBox>
                                    <TextBlock Margin="5" Text="MIN"  HorizontalAlignment="Left" Name="MinLabel" VerticalAlignment="Top" FontFamily="Segoe UI" />
                                    <TextBox   Text="{Binding Path=Min}" HorizontalAlignment="Right" MinWidth="94"  VerticalAlignment="Bottom" MaxLength="10"/>

                                    <CheckBox x:Name="NamLockCheckbox" IsChecked="{Binding Path=NamLock}" Content="NAM LOCK"></CheckBox>
                                </StackPanel>
                                
                                <StackPanel Margin="2" Orientation="Horizontal">
                                    <TextBlock Margin="5" Text="LOCK"  HorizontalAlignment="Left" Name="LockCodeLabel" VerticalAlignment="Top" FontFamily="Segoe UI" />
                                    <TextBox   Text="{Binding Path=UserLock}" HorizontalAlignment="Right" MinWidth="94"  VerticalAlignment="Bottom" />
                                    <TextBlock Margin="5" Text="SID"  HorizontalAlignment="Left" Name="SidLabel" VerticalAlignment="Top" FontFamily="Segoe UI" />
                                    <TextBox   Text="{Binding Path=Sid}" HorizontalAlignment="Right" MinWidth="94"  VerticalAlignment="Bottom" />
                                    <TextBlock Margin="5" Text="NID"  HorizontalAlignment="Left" Name="NidLabel" VerticalAlignment="Top" FontFamily="Segoe UI" />
                                    <TextBox   Text="{Binding Path=Nid}" HorizontalAlignment="Right" MinWidth="94"  VerticalAlignment="Bottom" />
                                </StackPanel>
                                    
                                
                                <StackPanel Margin="2" Orientation="Horizontal">
                                    <TextBlock Margin="5" Text="SPC" HorizontalAlignment="Left" Name="SpcLabel" VerticalAlignment="Top" FontFamily="Segoe UI" />
                                    <TextBox HorizontalAlignment="Left"  Text="{Binding Path=Spc}" MinWidth="94" MaxLength="6">
                                        <ContextMenuService.ContextMenu>
                                            <ContextMenu>
                                                <MenuItem Name="SendSpcZerosMenuItem" Header="Send 000000" Click="SendSpcZerosMenuItem_Click_1"/>
                                                <MenuItem Name="WriteSpcZerosMenuItem" Header="Write 000000" Click="WriteSpcZerosMenuItem_Click_1"/>
                                                <MenuItem Header="Copy" Command="Copy"></MenuItem>
                                                <MenuItem Header="Paste" Command="Paste"></MenuItem>
                                            </ContextMenu>
                                        </ContextMenuService.ContextMenu>
                                    </TextBox>
                                    <Button  Margin="5,0,0,0" HorizontalAlignment="Left" Name="sendSpc" Width="63" Click="sendSpc_Click">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="Resources/upload.png" Stretch="Uniform" Height="20" Width="20" />

                                        </StackPanel>
                                        <Button.ToolTip>
                                            <ToolTip>
                                                <TextBlock Text="send"/>
                                            </ToolTip>
                                        </Button.ToolTip>
                                    </Button>
                                    <ComboBox Margin="5,0,0,0"  HorizontalAlignment="Left"  Name="comboBox1" Width="120" 
                         SelectedItem="{Binding SpcReadType}"
                          ItemsSource="{Binding SpcReadTypeValues}"/>
                                    <Button  Margin="5,0,0,0"  HorizontalAlignment="Left" Name="readSpc" Width="63" Click="readSpc_Click" >
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="Resources/download.png" Stretch="Uniform" Height="20" Width="20" />

                                        </StackPanel>
                                        <Button.ToolTip>
                                            <ToolTip>
                                                <TextBlock Text="read"/>
                                            </ToolTip>
                                        </Button.ToolTip>
                                    </Button>
                                    <Button  Margin="5,0,0,0" HorizontalAlignment="Left" Name="writeSpc" Width="63" Click="writeSpc_Click">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="Resources/edit.png" Stretch="Uniform" Height="20" Width="20" />

                                        </StackPanel>
                                        <Button.ToolTip>
                                            <ToolTip>
                                                <TextBlock Text="write"/>
                                            </ToolTip>
                                        </Button.ToolTip>
                                    </Button>
                                    

                                </StackPanel>
                                <StackPanel Margin="2" Orientation="Horizontal">

                                    <TextBlock Margin="5" Text="UNLOCK MOTO EVDO" HorizontalAlignment="Left" Name="MotoUnlockLabel" VerticalAlignment="Top" FontFamily="Segoe UI" />


                                    <Button  Margin="5,0,0,0" HorizontalAlignment="Left" Name="sendMotoUnlock" Width="63" Click="sendMotoUnlock_Click">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="Resources/upload.png" Stretch="Uniform" Height="20" Width="20" />

                                        </StackPanel>

                                        <Button.ToolTip>
                                            <ToolTip>
                                                <TextBlock Text="write nv item 8035 0x00"/>
                                            </ToolTip>
                                        </Button.ToolTip>
                                        <ContextMenuService.ContextMenu>
                                            <ContextMenu>
                                                <MenuItem Name="RelockMoto" Header="Relock - write nv item 8035 0x01" Click="RelockMoto_Click_1"/>
                                            </ContextMenu>
                                        </ContextMenuService.ContextMenu>
                                    </Button>
                                    <TextBlock Margin="5" Text="NUM MIP PROF" HorizontalAlignment="Left" Name="NumMipProfLabel" VerticalAlignment="Top" FontFamily="Segoe UI" />
                                    <TextBox HorizontalAlignment="Left"  Text="{Binding Path=NumMipProfiles}" MinWidth="35"/>
                                    <TextBlock Margin="5" Text="MIP PROF ENABLE" HorizontalAlignment="Left" Name="EnabledMipProfile" VerticalAlignment="Top" FontFamily="Segoe UI" />
                                    <TextBox HorizontalAlignment="Left"  Text="{Binding Path=EnabledMipProfile}" MinWidth="35"/>

                                </StackPanel>

                                <StackPanel Margin="2" Orientation="Horizontal">
                                    <TextBlock Margin="5" Text="USER" HorizontalAlignment="Left" Name="UserLabel" VerticalAlignment="Top" FontFamily="Segoe UI" />
                                    <TextBox HorizontalAlignment="Left"  Text="{Binding Path=Username}" MinWidth="160"/>
                                    <TextBlock Margin="5" Text="PASS" HorizontalAlignment="Left" Name="PassLabel" VerticalAlignment="Top" FontFamily="Segoe UI" />
                                    <TextBox HorizontalAlignment="Left"  Text="{Binding Path=Password}" MinWidth="150"/>

                            
                                    <Button  Margin="7,0,0,0" HorizontalAlignment="Left" Name="writeEvdo" Width="63" Click="writeEvdo_Click">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="Resources/edit.png" Stretch="Uniform" Height="20" Width="20" />

                                        </StackPanel>
                                        <Button.ToolTip>
                                            <ToolTip>
                                                <TextBlock Text="write user and pass EVDO"/>
                                            </ToolTip>
                                        </Button.ToolTip>
                                    </Button>
                                   

                                </StackPanel>
                                <StackPanel Margin="2" Orientation="Horizontal">

                                    <TextBlock Margin="5" Text="MODE" HorizontalAlignment="Left" Name="ModeLabel" VerticalAlignment="Top" FontFamily="Segoe UI" />

                                    <ComboBox Margin="5,0,0,0"  HorizontalAlignment="Left"  Name="modeSwitch" MinWidth="175" 
                         SelectedItem="{Binding ModeChangeType}"
                          ItemsSource="{Binding ModeChangeTypeValues}"/>
                                    <Button  Margin="5,0,0,0" HorizontalAlignment="Left" Name="sendModeSwitch" Width="63" Click="sendModeSwitch_Click" >
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="Resources/upload.png" Stretch="Uniform" Height="20" Width="20" />

                                        </StackPanel>
                                        
                                        <Button.ToolTip>
                                            <ToolTip>
                                                <TextBlock Text="send"/>
                                            </ToolTip>
                                        </Button.ToolTip>
                                    </Button>
                                    <TextBlock Margin="5" Text="MIP" HorizontalAlignment="Left" Name="QcmipLabel" VerticalAlignment="Top" FontFamily="Segoe UI" />
                                    <ComboBox Margin="5,0,0,0"  HorizontalAlignment="Left"  Name="QcmipSwitch" MinWidth="145" 
                                         SelectedItem="{Binding Qcmip}"
                                         ItemsSource="{Binding QcmipTypeValues}"/>
                                    
                                </StackPanel>
                                <StackPanel Margin="2" Orientation="Horizontal">

                                    <TextBlock Margin="5" Text="PRL" HorizontalAlignment="Left" Name="PrlLabel" VerticalAlignment="Top" FontFamily="Segoe UI" />
                                    <TextBox HorizontalAlignment="Left"  Text="{Binding Path=PrlFilename}" Width="230">
                                        <TextBox.ToolTip>
                                            <ToolTip>
                                                <TextBlock Text="{Binding Path=PrlFilename}"/>
                                            </ToolTip>
                                        </TextBox.ToolTip>
                                    </TextBox>

                                    <Button  Margin="5,0,0,0" HorizontalAlignment="Left" Name="sendPrl2" Width="63" Click="sendPrl_Click" >
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="Resources/edit.png" Stretch="Uniform" Height="20" Width="20" />

                                        </StackPanel>

                                        <Button.ToolTip>
                                            <ToolTip>
                                                <TextBlock Text="write prl"/>
                                            </ToolTip>
                                        </Button.ToolTip>
                                    </Button>
                                    <Button  Margin="5,0,0,0" HorizontalAlignment="Left" Name="ChoosePrl" Width="63" Click="ChoosePrl_Click"  >
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="Resources/folder.png" Stretch="Uniform" Height="20" Width="20" />

                                        </StackPanel>

                                        <Button.ToolTip>
                                            <ToolTip>
                                                <TextBlock Text="select .prl file"/>
                                            </ToolTip>
                                        </Button.ToolTip>
                                    </Button>
                                    <Button  Margin="5,0,0,0"  HorizontalAlignment="Left" Name="readPrl" Width="63" Click="readPrl_Click" Visibility="Hidden" >
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="Resources/download.png" Stretch="Uniform" Height="20" Width="20" />

                                        </StackPanel>
                                        <Button.ToolTip>
                                            <ToolTip>
                                                <TextBlock Text="read"/>
                                            </ToolTip>
                                        </Button.ToolTip>
                                    </Button>
                                </StackPanel>
                            </StackPanel>
                            
                        </Grid>
                    </TabItem>
                    <TabItem Header="NV" Name="NV">
                        <TabControl>
                            
                            <TabItem Header="EVDO/Edit" Name="EditNV">
                                
                                <Grid >
                                    
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="70*"/>
                                        <ColumnDefinition Width="183*"/>
                                    </Grid.ColumnDefinitions>
                                    
                                    <ListBox x:Name="NvList" HorizontalContentAlignment="Stretch" ItemsSource="{Binding NvItems}" Margin="0,0,0,0" Grid.ColumnSpan="2">
                                        <ListBox.ItemTemplate>
                                            <DataTemplate>
                                                <Grid >
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="150" />
                                                        <ColumnDefinition Width="*" />
                                                    </Grid.ColumnDefinitions>
                                                    <TextBox Text="{Binding Key,  Mode=OneWay}" Margin="1" Grid.Column="0" BorderThickness="0"  IsReadOnly="True">
                                                        <TextBox.ToolTip>
                                                            <ToolTip>
                                                                <TextBlock Text="{Binding Key}"/>
                                                            </ToolTip>
                                                        </TextBox.ToolTip>

                                                    </TextBox>
                                                    <TextBox Text="{Binding Value.DisplayData}" Margin="1" Grid.Column="1" >
                                                        <TextBox.ToolTip>
                                                            <ToolTip>
                                                                <TextBlock Text="string or 0xFFFF..."/>
                                                            </ToolTip>
                                                        </TextBox.ToolTip>
                                                        <ContextMenuService.ContextMenu>
                                                            <ContextMenu>
                                                                <MenuItem Name="NvEditShowHex" Header="Show hex" 
                                                                           CommandParameter="{Binding Value}" Click="NvEditShowHex_Click"/>
                                                                <MenuItem Header="Copy" Command="Copy"></MenuItem>
                                                                <MenuItem Header="Paste" Command="Paste"></MenuItem>
                                                            </ContextMenu>
                                                        </ContextMenuService.ContextMenu>
                                                    </TextBox>
                                                </Grid>
                                            </DataTemplate>
                                        </ListBox.ItemTemplate>
                                    </ListBox>
                                </Grid>
                            </TabItem>
                            <TabItem Header="Read NV" Name="ReadNV">
                                <StackPanel Margin="2" Orientation="Horizontal">
                                    <TextBlock Margin="5" Text="Read NV items to file" HorizontalAlignment="Left" Name="ReadNvLabel" VerticalAlignment="Top" FontFamily="Segoe UI" />
                                    <TextBox HorizontalAlignment="Left"  Name="ReadNvItemTextbox"  MinWidth="94" >

                                    </TextBox>
                                    <Button  Margin="5,0,0,0" HorizontalAlignment="Left" Name="ReadNvItem" Width="63" Click="ReadNvItem_Click" >
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="Resources/upload.png" Stretch="Uniform" Height="20" Width="20" />

                                        </StackPanel>
                                        <Button.ToolTip>
                                            <ToolTip>
                                                <TextBlock Text="send"/>
                                            </ToolTip>
                                        </Button.ToolTip>
                                    </Button>



                                </StackPanel>
                            </TabItem>
                        </TabControl>
                            
                </TabItem>
                    <TabItem Header="SP" Name="SpTab">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition MinWidth="340" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <StackPanel Grid.Column="0">
                                <ComboBox ItemsSource="{Binding SpSixteenDigit}" HorizontalAlignment="Stretch" Margin="2" Name="spBox" VerticalAlignment="Top" MinWidth="300" SelectedValuePath="Value" SelectedValue="{Binding SixteenDigitSP}" DisplayMemberPath="Key" />
                                <TextBox Text="{Binding SixteenDigitSP}" HorizontalAlignment="Stretch" Margin="2" MinWidth="300"></TextBox>
                                <CheckBox x:Name="ReadEfsNv85" IsChecked="{Binding Path=NamLock}" Content="READ EFS NV 85 SPC"></CheckBox>
                            </StackPanel>
                            <StackPanel Grid.Column="1">
                                <Button  Margin="5" MinHeight="70" MinWidth="70" Name="SendSP" Click="SendSP_Click" >
                                    <StackPanel Orientation="Horizontal">
                                        <Image Source="Resources/upload.png" Stretch="Uniform" Height="40" Width="40" />

                                    </StackPanel>
                                    <Button.ToolTip>
                                        <ToolTip>
                                            <TextBlock Text="send"/>
                                        </ToolTip>
                                    </Button.ToolTip>
                                </Button>
                            </StackPanel>
                        </Grid>
                    </TabItem>
                    <TabItem Header="Term" Name="TerminalTab">
                        <TabControl>
                            <TabItem Name="QC" Header="QC">
                                <Grid >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition MinWidth="310" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <StackPanel Grid.Column="0">
                                        <TextBox Name="TermCommand" HorizontalAlignment="Stretch" Margin="2" MinWidth="300"></TextBox>
                                        <StackPanel Orientation="Horizontal">
                                            <CheckBox Name="TermAppendCrc" Content="ADD CRC + 7E"></CheckBox>
                                        </StackPanel>
                                    </StackPanel>
                                    <StackPanel Grid.Column="1">
                                        <Button  Margin="5" MinHeight="70" MinWidth="70" Name="SendTerm" Click="SendTerm_Click" >
                                            <StackPanel Orientation="Horizontal">
                                                <Image Source="Resources/upload.png" Stretch="Uniform" Height="40" Width="40" />

                                            </StackPanel>
                                            <Button.ToolTip>
                                                <ToolTip>
                                                    <TextBlock Text="send"/>
                                                </ToolTip>
                                            </Button.ToolTip>
                                        </Button>
                                    </StackPanel>
                                </Grid>
                            </TabItem>
                            <TabItem Name="AT" Header="AT">
                                <Grid >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition MinWidth="310" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <StackPanel Grid.Column="0">
                                        <TextBox Name="AtCommand" HorizontalAlignment="Stretch" Margin="2" MinWidth="300"></TextBox>
                                        
                                    </StackPanel>
                                    <StackPanel Grid.Column="1">
                                        <Button  Margin="5" MinHeight="70" MinWidth="70" Name="SendAt" Click="SendAt_Click" >
                                            <StackPanel Orientation="Horizontal">
                                                <Image Source="Resources/upload.png" Stretch="Uniform" Height="40" Width="40" />

                                            </StackPanel>
                                            <Button.ToolTip>
                                                <ToolTip>
                                                    <TextBlock Text="send"/>
                                                </ToolTip>
                                            </Button.ToolTip>
                                        </Button>
                                    </StackPanel>
                                </Grid>
                            </TabItem>
                        </TabControl>
                        
                    </TabItem>
                    <TabItem Header="Keys" Name="KeysTab">
                        <Grid>
                            <StackPanel HorizontalAlignment="Center">
                                <StackPanel Orientation="Horizontal">
                                    <Button Content="1" Margin="5" MinHeight="70" MinWidth="70" FontSize="28" Name="key1" Click="key1_Click" />
                                    <Button Content="2" Margin="5" MinHeight="70" MinWidth="70" FontSize="28" Name="key2" Click="key2_Click" />
                                    <Button Content="3" Margin="5" MinHeight="70" MinWidth="70" FontSize="28" Name="key3" Click="key3_Click" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <Button Content="4" Margin="5" MinHeight="70" MinWidth="70" FontSize="28" Name="key4" Click="key4_Click" />
                                    <Button Content="5" Margin="5" MinHeight="70" MinWidth="70" FontSize="28" Name="key5" Click="key5_Click" />
                                    <Button Content="6" Margin="5" MinHeight="70" MinWidth="70" FontSize="28" Name="key6" Click="key6_Click" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <Button Content="7" Margin="5" MinHeight="70" MinWidth="70" FontSize="28" Name="key7" Click="key7_Click" />
                                    <Button Content="8" Margin="5" MinHeight="70" MinWidth="70" FontSize="28" Name="key8" Click="key8_Click" />
                                    <Button Content="9" Margin="5" MinHeight="70" MinWidth="70" FontSize="28" Name="key9" Click="key9_Click" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <Button Content="*" Margin="5" MinHeight="70" MinWidth="70" FontSize="28" Name="keyStar" Click="keyStar_Click" />
                                    <Button Content="0" Margin="5" MinHeight="70" MinWidth="70" FontSize="28" Name="key0" Click="key0_Click" />
                                    <Button Content="#" Margin="5" MinHeight="70" MinWidth="70" FontSize="28" Name="keyPound" Click="keyPound_Click" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <Button Content="call" Margin="5" MinHeight="70" MinWidth="70" FontSize="28" Name="keySend" Click="keySend_Click" />
                                    <Button Content="end" Margin="5" MinHeight="70" MinWidth="70" FontSize="28" Name="keyEnd" Click="keyEnd_Click"  />
                                </StackPanel>
                            </StackPanel>
                        </Grid>
                    </TabItem>
                    <TabItem Header="Log" Name="Log">
                    <Grid >
                        <TextBox Text="{Binding Path=LogData}" TextWrapping="Wrap" Height="300" VerticalScrollBarVisibility="Visible" VerticalAlignment="Bottom" />
                    </Grid>
                </TabItem>
               
                    <TabItem Header="Wiki" Name="Wiki">
                        
                            <WebBrowser x:Name="wikiWebBrowser" HorizontalAlignment="Center" DockPanel.Dock="Top"  MinHeight="350"/>
                       
                    </TabItem>
                    <TabItem Header="Script" Name="Script">
                        <StackPanel>
                            
                            <avalonedit:TextEditor Name="CodeTextEditor" 
                                                   FontFamily="Consolas"
                                                   FontSize="10pt" 
                                                   ShowLineNumbers="True" 
                                                   MaxHeight="325"
                                                   AllowDrop="True"
                                                   PreviewDragEnter="FileShowTextBox_PreviewDragEnter"
                                                   PreviewDragOver="FileShowTextBox_PreviewDragEnter"
                                                   PreviewDrop="FileShowTextBox_PreviewDrop" />
                            
                            <TextBlock Margin="5" Text="WARNING: Scripts execute code: know what you are running.  USE AT OWN RISK!"  HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Segoe UI" />

                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">

                                <Button  Margin="2" HorizontalAlignment="Left" Name="SaveScript" Width="63" Click="SaveScript_Click" >
                                    <StackPanel Orientation="Horizontal">
                                        <Image Source="Resources/edit.png" Stretch="Uniform" Height="20" Width="20" />

                                    </StackPanel>

                                    <Button.ToolTip>
                                        <ToolTip>
                                            <TextBlock Text="save script"/>
                                        </ToolTip>
                                    </Button.ToolTip>
                                </Button>
                                <Button  Margin="2" HorizontalAlignment="Left" Name="OpenScript" Width="63" Click="ChooseScript_Click"  >
                                    <StackPanel Orientation="Horizontal">
                                        <Image Source="Resources/folder.png" Stretch="Uniform" Height="20" Width="20" />

                                    </StackPanel>

                                    <Button.ToolTip>
                                        <ToolTip>
                                            <TextBlock Text="open script"/>
                                        </ToolTip>
                                    </Button.ToolTip>
                                </Button>
                                <Button  Margin="2" HorizontalAlignment="Right"  Name="runScript"  Width="60" Click="runScript_Click"  >
                                    <StackPanel Orientation="Horizontal">
                                        <Image Source="Resources/upload.png" Stretch="Uniform" Height="20" Width="20" />

                                    </StackPanel>

                                    <Button.ToolTip>
                                        <ToolTip>
                                            <TextBlock Text="run script"/>
                                        </ToolTip>
                                    </Button.ToolTip>

                                </Button>
                            </StackPanel>
                            
                        </StackPanel>
                    </TabItem>
                </TabControl>
                <Grid Margin="0,5,0,2" VerticalAlignment="Bottom">
                    <TextBox Text="{Binding Path=Msg}" TextWrapping="Wrap" Height="40" VerticalScrollBarVisibility="Visible" VerticalAlignment="Bottom" />
                </Grid>
            </StackPanel>
    </Grid>
    </Grid>
</metro:Window>
